/*  ----------------------------------------------------------------------------
 *  Arello Mobile
 *  Fast 3d Engine
 *  ----------------------------------------------------------------------------
 * Except where otherwise noted, this work is licensed under
 * http://creativecommons.org/licenses/by/3.0
 */

#ifndef __LIB2D_GUI_VIEW_BUTTON_H__
#define __LIB2D_GUI_VIEW_BUTTON_H__

#include <lib2d/objects/Imagesimple.h>
#include <xml/Object.h>
#include "Object.h"
#include "Margined.h"

namespace liba
{
namespace lib2d
{
namespace gui
{
class Button;
namespace view
{

class Button : 
	public Object,
	public xml::ObjectANSI
{
	Margined normal;
	Margined over;
	Margined pressed;
protected:
	AutoPtr< objects::ImageSimple > image;
	const gui::Button * obj;
public:
	explicit Button( gui::Button * obj );
	virtual ~Button()
	{}
	virtual void render( hard::Renderer * rend );

	virtual bool on_attribute( xml::Provider * prov, const std::string & name, const std::string & value );
	virtual bool on_node( xml::Provider * prov, const std::string & name );

	double get_height()const
	{
		return normal.get_rect().height;
	}
	double get_width()const
	{
		return normal.get_rect().width;
	}
};

} //namespace view
} //namespace gui
} //namespace lib2d
} //namespace liba

using namespace liba;

#endif //__LIB2D_GUI_VIEW_BUTTON_H__
